/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Oswl_C
 */
@Entity
@Table(name = "item_test", catalog = "lecturadb", schema = "")
@NamedQueries({
    @NamedQuery(name = "ItemTest.findAll", query = "SELECT i FROM ItemTest i"),
    @NamedQuery(name = "ItemTest.findByIteCodigo", query = "SELECT i FROM ItemTest i WHERE i.iteCodigo = :iteCodigo"),
    @NamedQuery(name = "ItemTest.findByTesCodigo", query = "SELECT i FROM ItemTest i WHERE i.tesCodigo = :tesCodigo"),
    @NamedQuery(name = "ItemTest.findByItePregunta", query = "SELECT i FROM ItemTest i WHERE i.itePregunta = :itePregunta")})
public class ItemTest implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ITE_CODIGO")
    private Integer iteCodigo;
    @ManyToOne
    @JoinColumn(name = "TES_CODIGO")
    private Test tesCodigo;
    @Column(name = "ITE_PREGUNTA")
    private String itePregunta;

    public ItemTest() {
    }

    public ItemTest(Integer iteCodigo) {
        this.iteCodigo = iteCodigo;
    }

    public Integer getIteCodigo() {
        return iteCodigo;
    }

    public void setIteCodigo(Integer iteCodigo) {
        Integer oldIteCodigo = this.iteCodigo;
        this.iteCodigo = iteCodigo;
        changeSupport.firePropertyChange("iteCodigo", oldIteCodigo, iteCodigo);
    }

    public Test getTesCodigo() {
        return tesCodigo;
    }

    public void setTesCodigo(Test tesCodigo) {
        Test oldTesCodigo = this.tesCodigo;
        this.tesCodigo = tesCodigo;
        changeSupport.firePropertyChange("tesCodigo", oldTesCodigo, tesCodigo);
    }

    public String getItePregunta() {
        return itePregunta;
    }

    public void setItePregunta(String itePregunta) {
        String oldItePregunta = this.itePregunta;
        this.itePregunta = itePregunta;
        changeSupport.firePropertyChange("itePregunta", oldItePregunta, itePregunta);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iteCodigo != null ? iteCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemTest)) {
            return false;
        }
        ItemTest other = (ItemTest) object;
        if ((this.iteCodigo == null && other.iteCodigo != null) || (this.iteCodigo != null && !this.iteCodigo.equals(other.iteCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return itePregunta;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
